package com.example.demo01.mapper;

import com.example.demo01.entity.MiddleRole;
import com.example.demo01.entity.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleMapper {
    @Insert("insert into role(id,rolename,remark)values(#{id},#{rolename},#{remark});")
    public int insert(Role role);
    @Delete(" delete from role where id=#{id};")
    public int delete(int id);
    @Select("select * from role where rolename like '%${rolename}%';")
    public List<Role> getname(String rolename);

    @Select(" SELECT rolename,role.id,COUNT(pid) as counts FROM prole LEFT JOIN role ON rid=role.id GROUP BY rid")
    public List<MiddleRole> getname01(int id,String rolename,String counts);

}
